package com.yueqian.service.impl;

import com.github.pagehelper.PageHelper;
import com.yueqian.dao.IOrdersDao;
import com.yueqian.domain.Orders;
import com.yueqian.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersServiceImpl implements IOrdersService {

    @Autowired
    private IOrdersDao ordersDao;

    @Override
    public List<Orders> findAll() throws Exception {
        List<Orders> ordersList = ordersDao.findAll();
        return ordersList;
    }

    @Override
    public List<Orders> findAll(Integer page, Integer pageSize) throws Exception {
        //使用分页插件
        PageHelper.startPage(page, pageSize);
        List<Orders> ordersList = ordersDao.findAll();
        return ordersList;
    }

    @Override
    public Orders findById(String oid) throws Exception {
        Orders orders = ordersDao.findById(oid);
        return orders;
    }
}
